#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
using namespace boost;
using namespace std;

typedef shared_ptr<string> string_sptr;
string_sptr gsp;

int main()
{
    string_sptr sp1 = make_shared<string>("Hi");
    gsp = sp1;
    string_sptr sp2 = make_shared<string>("You");
    cout << "sp1: " << *sp1 << endl;
    cout << "gsp: " << *gsp << endl;
    cout << "sp2: " << *sp2 << endl;

    cout << "-------------" << endl;
    sp1.swap(sp2);

    cout << "sp1: " << *sp1 << endl;
    cout << "gsp: " << *gsp << endl;
    cout << "sp2: " << *sp2 << endl;

    cout << "-------------" << endl;
    string_sptr sp3 = make_shared<string>("Me");
    sp2 = sp3;

    cout << "sp1: " << *sp1 << endl;
    cout << "gsp: " << *gsp << endl;
    cout << "sp2: " << *sp2 << endl;

    return 0;
}
